<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>fetch发送ajax请求</title>
</head>
<body>
  <button>POST</button>
  <script>
      var btn = document.querySelector('button');
      btn.onclick = function () {
        fetch('http://localhost:8000/fetch-server',{
          //请求方法
          method:'POST',
          //请求头
          headers: {
            name:'cty',
            age:'18'
          },
          //请求体
          body: 'age=18&name=cty',
        }).then(response => {
          console.log(response);
        })
      }
  </script>
</body>
</html>